package satir.testcase.framework;

import junit.framework.TestCase;

import org.junit.Before;
import org.junit.Test;

import satir.framework.*;
import satir.framework.JSONIOPerformer.JSONIOPerformerJSONDecodeException;
import satir.framework.JSONIOPerformer.JSONIOPerformerReadException;

public class JSONIOPeroformer_JSONIOPerformer_1 extends TestCase {

	private JSONIOPerformer jsonIO;

	@Before
	public void setUp() {
	}
	
	//Step 1
	@Test
	public void testValidFilename() {
		try {
			jsonIO = new JSONIOPerformer("HelloWorld.json");
			assertEquals(true, true);
		} catch (JSONIOPerformerReadException e) {
			fail("JSONIOPerformerReadException Catched!");
		} catch (JSONIOPerformerJSONDecodeException e) {
			fail("JSONIOPerformerJSONDecodeException Catched!");
		}
	}
	
	//Step 2
	@Test
	public void testInvalidFilename() {
		try {
			jsonIO = new JSONIOPerformer("HelloWorldInvalid.json");
			fail("JSONObject is craeted");
		} catch (JSONIOPerformerReadException e) {
			assertEquals(true, true);
		} catch (JSONIOPerformerJSONDecodeException e) {
			fail("JSONIOPerformerJSONDecodeException Catched!");
		}
	}
	
	//Step 3
	@Test
	public void testInvalidStructure() {
		try {
			jsonIO = new JSONIOPerformer("HelloWorld.txt");
			fail("JSONObject is craeted");
		} catch (JSONIOPerformerReadException e) {
			fail("JSONIOPerformerReadException Catched!");
		} catch (JSONIOPerformerJSONDecodeException e) {
			assertEquals(true, true);			
		}
	}

}
